import uuid


from common import *

class IndexHandler(pyrestful.rest.RestHandler):
	@get(_path='/', _produces=mediatypes.APPLICATION_JSON)
	def show_index(self):
        self.set_secure_cookie('username' , 'jamesduan')
        self.set_header('Access-Control-Allow-Origin', '*')
        self.set_header('Access-Control-Allow-Methods', 'POST, GET, OPTIONS')
        self.set_header('Access-Control-Max-Age', 1000)
        self.set_header('Access-Control-Allow-Headers', '*')
        self.set_header('Content-type', 'application/json')
        self.set_secure_cookie('_nick_name', 'jamesduan')
        self.set_secure_cookie('_access_token', ''.join(str(uuid.uuid4()).split('-')))
        self.set_header('_Token', ''.join(str(uuid.uuid4()).split('-')))

		return {"msg" : "hello world!"}

